 /* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.





Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/


#import <Foundation/Foundation.h>
#import <JDCloudOCSDKKms/KmsModel.h>

@implementation KeyDescCfg
-(id) initWithKeyName:(NSString*) keyName
      keyDesc:(NSString*)keyDesc
      keyType:(NSNumber*)keyType { 
     self.keyName = keyName;               
     self.keyDesc = keyDesc;               
     self.keyType = keyType;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self keyName])
    {
        [result setValue:[self keyName] forKey:@"keyName"];
    }
    if([self keyDesc])
    {
        [result setValue:[self keyDesc] forKey:@"keyDesc"];
    }
    if([self keyType])
    {
        [result setValue:[self keyType] forKey:@"keyType"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.keyName = [dictionary objectForKey:@"keyName"];
    self.keyDesc = [dictionary objectForKey:@"keyDesc"];
    self.keyType = [dictionary objectForKey:@"keyType"];
    return self;
}
 @end
@implementation KeyRotateCfg
-(id) initWithAutoRotate:(NSNumber*) autoRotate
      rotationCycle:(NSNumber*)rotationCycle { 
     self.autoRotate = autoRotate;               
     self.rotationCycle = rotationCycle;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self autoRotate])
    {
        [result setValue:[self autoRotate] forKey:@"autoRotate"];
    }
    if([self rotationCycle])
    {
        [result setValue:[self rotationCycle] forKey:@"rotationCycle"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.autoRotate = [dictionary objectForKey:@"autoRotate"];
    self.rotationCycle = [dictionary objectForKey:@"rotationCycle"];
    return self;
}
 @end
@implementation KeyVersionItem
-(id) initWithKeyVersion:(NSString*) keyVersion
      createTime:(NSString*)createTime
      keyStatus:(NSNumber*)keyStatus
      deleteTime:(NSString*)deleteTime { 
     self.keyVersion = keyVersion;               
     self.createTime = createTime;               
     self.keyStatus = keyStatus;               
     self.deleteTime = deleteTime;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self keyVersion])
    {
        [result setValue:[self keyVersion] forKey:@"keyVersion"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    if([self keyStatus])
    {
        [result setValue:[self keyStatus] forKey:@"keyStatus"];
    }
    if([self deleteTime])
    {
        [result setValue:[self deleteTime] forKey:@"deleteTime"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.keyVersion = [dictionary objectForKey:@"keyVersion"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    self.keyStatus = [dictionary objectForKey:@"keyStatus"];
    self.deleteTime = [dictionary objectForKey:@"deleteTime"];
    return self;
}
 @end
@implementation KeyInfo
-(id) initWithKeyId:(NSString*) keyId
      keyName:(NSString*)keyName
      keyStatus:(NSNumber*)keyStatus
      createTime:(NSString*)createTime
      keyDesc:(NSString*)keyDesc
      rotationCycle:(NSNumber*)rotationCycle
      deleteTime:(NSString*)deleteTime { 
     self.keyId = keyId;               
     self.keyName = keyName;               
     self.keyStatus = keyStatus;               
     self.createTime = createTime;               
     self.keyDesc = keyDesc;               
     self.rotationCycle = rotationCycle;               
     self.deleteTime = deleteTime;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self keyId])
    {
        [result setValue:[self keyId] forKey:@"keyId"];
    }
    if([self keyName])
    {
        [result setValue:[self keyName] forKey:@"keyName"];
    }
    if([self keyStatus])
    {
        [result setValue:[self keyStatus] forKey:@"keyStatus"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    if([self keyDesc])
    {
        [result setValue:[self keyDesc] forKey:@"keyDesc"];
    }
    if([self rotationCycle])
    {
        [result setValue:[self rotationCycle] forKey:@"rotationCycle"];
    }
    if([self deleteTime])
    {
        [result setValue:[self deleteTime] forKey:@"deleteTime"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.keyId = [dictionary objectForKey:@"keyId"];
    self.keyName = [dictionary objectForKey:@"keyName"];
    self.keyStatus = [dictionary objectForKey:@"keyStatus"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    self.keyDesc = [dictionary objectForKey:@"keyDesc"];
    self.rotationCycle = [dictionary objectForKey:@"rotationCycle"];
    self.deleteTime = [dictionary objectForKey:@"deleteTime"];
    return self;
}
 @end
@implementation SecretInfo
-(id) initWithSecretId:(NSString*) secretId
      secretName:(NSString*)secretName
      secretDesc:(NSString*)secretDesc
      secretStatus:(NSNumber*)secretStatus
      createTime:(NSString*)createTime { 
     self.secretId = secretId;               
     self.secretName = secretName;               
     self.secretDesc = secretDesc;               
     self.secretStatus = secretStatus;               
     self.createTime = createTime;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self secretId])
    {
        [result setValue:[self secretId] forKey:@"secretId"];
    }
    if([self secretName])
    {
        [result setValue:[self secretName] forKey:@"secretName"];
    }
    if([self secretDesc])
    {
        [result setValue:[self secretDesc] forKey:@"secretDesc"];
    }
    if([self secretStatus])
    {
        [result setValue:[self secretStatus] forKey:@"secretStatus"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.secretId = [dictionary objectForKey:@"secretId"];
    self.secretName = [dictionary objectForKey:@"secretName"];
    self.secretDesc = [dictionary objectForKey:@"secretDesc"];
    self.secretStatus = [dictionary objectForKey:@"secretStatus"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    return self;
}
 @end
@implementation SecretVersionItem
-(id) initWithSecretVersion:(NSString*) secretVersion
      secretStatus:(NSNumber*)secretStatus
      startTime:(NSString*)startTime
      expireTime:(NSString*)expireTime
      secretData:(NSString*)secretData { 
     self.secretVersion = secretVersion;               
     self.secretStatus = secretStatus;               
     self.startTime = startTime;               
     self.expireTime = expireTime;               
     self.secretData = secretData;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self secretVersion])
    {
        [result setValue:[self secretVersion] forKey:@"secretVersion"];
    }
    if([self secretStatus])
    {
        [result setValue:[self secretStatus] forKey:@"secretStatus"];
    }
    if([self startTime])
    {
        [result setValue:[self startTime] forKey:@"startTime"];
    }
    if([self expireTime])
    {
        [result setValue:[self expireTime] forKey:@"expireTime"];
    }
    if([self secretData])
    {
        [result setValue:[self secretData] forKey:@"secretData"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.secretVersion = [dictionary objectForKey:@"secretVersion"];
    self.secretStatus = [dictionary objectForKey:@"secretStatus"];
    self.startTime = [dictionary objectForKey:@"startTime"];
    self.expireTime = [dictionary objectForKey:@"expireTime"];
    self.secretData = [dictionary objectForKey:@"secretData"];
    return self;
}
 @end
@implementation SecretTimeCfg
-(id) initWithStartTime:(NSString*) startTime
      expireTime:(NSString*)expireTime { 
     self.startTime = startTime;               
     self.expireTime = expireTime;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self startTime])
    {
        [result setValue:[self startTime] forKey:@"startTime"];
    }
    if([self expireTime])
    {
        [result setValue:[self expireTime] forKey:@"expireTime"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.startTime = [dictionary objectForKey:@"startTime"];
    self.expireTime = [dictionary objectForKey:@"expireTime"];
    return self;
}
 @end
@implementation SecretDescCfg
-(id) initWithSecretName:(NSString*) secretName
      secretDesc:(NSString*)secretDesc { 
     self.secretName = secretName;               
     self.secretDesc = secretDesc;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self secretName])
    {
        [result setValue:[self secretName] forKey:@"secretName"];
    }
    if([self secretDesc])
    {
        [result setValue:[self secretDesc] forKey:@"secretDesc"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.secretName = [dictionary objectForKey:@"secretName"];
    self.secretDesc = [dictionary objectForKey:@"secretDesc"];
    return self;
}
 @end
@implementation KeyDetail
-(id) initWithKeyId:(NSString*) keyId
      keyName:(NSString*)keyName
      rotationCycle:(NSNumber*)rotationCycle
      keyVersionCount:(NSNumber*)keyVersionCount
      keyVersionList:(NSArray<KeyVersionItem*>*)keyVersionList { 
     self.keyId = keyId;               
     self.keyName = keyName;               
     self.rotationCycle = rotationCycle;               
     self.keyVersionCount = keyVersionCount;               
     self.keyVersionList = keyVersionList;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self keyId])
    {
        [result setValue:[self keyId] forKey:@"keyId"];
    }
    if([self keyName])
    {
        [result setValue:[self keyName] forKey:@"keyName"];
    }
    if([self rotationCycle])
    {
        [result setValue:[self rotationCycle] forKey:@"rotationCycle"];
    }
    if([self keyVersionCount])
    {
        [result setValue:[self keyVersionCount] forKey:@"keyVersionCount"];
    }
    if([self keyVersionList])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self keyVersionList] count]; i++) {
            KeyVersionItem* item = [[self keyVersionList] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"keyVersionList"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.keyId = [dictionary objectForKey:@"keyId"];
    self.keyName = [dictionary objectForKey:@"keyName"];
    self.rotationCycle = [dictionary objectForKey:@"rotationCycle"];
    self.keyVersionCount = [dictionary objectForKey:@"keyVersionCount"];
    NSArray* keyVersionListArray = [dictionary objectForKey:@"keyVersionList"];
    if(keyVersionListArray&&![keyVersionListArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [keyVersionListArray count];i++)
        {
            KeyVersionItem* item = [[KeyVersionItem alloc]initWithDic:[keyVersionListArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.keyVersionList = propertyArray;
    }
    return self;
}
 @end
@implementation KeyCfg
-(id) initWithKeyDescCfg:(KeyDescCfg*) keyDescCfg
      keyRotateCfg:(KeyRotateCfg*)keyRotateCfg { 
     self.keyDescCfg = keyDescCfg;               
     self.keyRotateCfg = keyRotateCfg;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self keyDescCfg])
    {
        [result setValue:[[self keyDescCfg] dictionary]forKey:@"keyDescCfg"];
    }
    if([self keyRotateCfg])
    {
        [result setValue:[[self keyRotateCfg] dictionary]forKey:@"keyRotateCfg"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.keyDescCfg = [[KeyDescCfg alloc]initWithDic:[dictionary objectForKey:@"keyDescCfg"]];
    self.keyRotateCfg = [[KeyRotateCfg alloc]initWithDic:[dictionary objectForKey:@"keyRotateCfg"]];
    return self;
}
 @end
@implementation SecretCfg
-(id) initWithSecretDescCfg:(SecretDescCfg*) secretDescCfg
      secretTimeCfg:(SecretTimeCfg*)secretTimeCfg
      secretData:(NSString*)secretData { 
     self.secretDescCfg = secretDescCfg;               
     self.secretTimeCfg = secretTimeCfg;               
     self.secretData = secretData;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self secretDescCfg])
    {
        [result setValue:[[self secretDescCfg] dictionary]forKey:@"secretDescCfg"];
    }
    if([self secretTimeCfg])
    {
        [result setValue:[[self secretTimeCfg] dictionary]forKey:@"secretTimeCfg"];
    }
    if([self secretData])
    {
        [result setValue:[self secretData] forKey:@"secretData"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.secretDescCfg = [[SecretDescCfg alloc]initWithDic:[dictionary objectForKey:@"secretDescCfg"]];
    self.secretTimeCfg = [[SecretTimeCfg alloc]initWithDic:[dictionary objectForKey:@"secretTimeCfg"]];
    self.secretData = [dictionary objectForKey:@"secretData"];
    return self;
}
 @end
@implementation SecretVersionCfg
-(id) initWithSecretData:(NSString*) secretData
      secretTimeCfg:(SecretTimeCfg*)secretTimeCfg { 
     self.secretData = secretData;               
     self.secretTimeCfg = secretTimeCfg;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self secretData])
    {
        [result setValue:[self secretData] forKey:@"secretData"];
    }
    if([self secretTimeCfg])
    {
        [result setValue:[[self secretTimeCfg] dictionary]forKey:@"secretTimeCfg"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.secretData = [dictionary objectForKey:@"secretData"];
    self.secretTimeCfg = [[SecretTimeCfg alloc]initWithDic:[dictionary objectForKey:@"secretTimeCfg"]];
    return self;
}
 @end
@implementation SecretDetail
-(id) initWithSecretInfo:(SecretInfo*) secretInfo
      secretVersionCount:(NSNumber*)secretVersionCount
      secretVersionList:(NSArray<SecretVersionItem*>*)secretVersionList { 
     self.secretInfo = secretInfo;               
     self.secretVersionCount = secretVersionCount;               
     self.secretVersionList = secretVersionList;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self secretInfo])
    {
        [result setValue:[[self secretInfo] dictionary]forKey:@"secretInfo"];
    }
    if([self secretVersionCount])
    {
        [result setValue:[self secretVersionCount] forKey:@"secretVersionCount"];
    }
    if([self secretVersionList])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self secretVersionList] count]; i++) {
            SecretVersionItem* item = [[self secretVersionList] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"secretVersionList"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.secretInfo = [[SecretInfo alloc]initWithDic:[dictionary objectForKey:@"secretInfo"]];
    self.secretVersionCount = [dictionary objectForKey:@"secretVersionCount"];
    NSArray* secretVersionListArray = [dictionary objectForKey:@"secretVersionList"];
    if(secretVersionListArray&&![secretVersionListArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [secretVersionListArray count];i++)
        {
            SecretVersionItem* item = [[SecretVersionItem alloc]initWithDic:[secretVersionListArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.secretVersionList = propertyArray;
    }
    return self;
}
 @end
 
 


